home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / msdos / mxmenu.zip / INST.MNU < prev    next >
Text File  |  1992-08-25  |  13KB  |  443 lines

  1. Comment
  2. =========================================================
  3.  
  4. MarxMenu installation Menu:
  5.  
  6. Copyright 1989-1992 by Marc Perkel * All rights reserved.
  7.  
  8. This is an example of how MarxMenu can be used as a job control
  9. language. There is quite an education in MarxMenu tricks here. If
  10. you want to write a similar program, this menu is worth studying.
  11.  
  12. =========================================================
  13. EndComment
  14.  
  15. Var
  16.   EchoSt
  17.   FileLine
  18.   FileLinePtr
  19.   ProgName
  20.   BatExit
  21.   EchoTail
  22.   ConfigSysPath
  23.   ConfigSysLines
  24.   WorkStr
  25.   DosVerNumber
  26.  
  27. Const
  28.   PauseTime = 100
  29.  
  30. DelFile 'MENUS.EXE'
  31.  
  32. InitialDisplay
  33.  
  34. Shadow Off
  35. DrawBox 25 11 31 7
  36.  
  37. DosVerNumber = DosVersion * 100 + MinorDosVersion
  38.  
  39. ;MXECHO is a debugging environment variable. Use SET MXMENU=OFF for
  40. ;normal use. SET MXECHO=ON to watch the MARX.BAT run.
  41.  
  42. If ReadEnv('MXECHO') > ''
  43.    EchoTail = '%MXECHO%'
  44. Else
  45.    EchoTail = 'ON'
  46. EndIf
  47.  
  48. if DosVerNumber >= 330
  49.    EchoSt = '@ECHO ' + EchoTail
  50. else
  51.    EchoSt = 'ECHO ' + EchoTail
  52. endif
  53.  
  54.  
  55. ProgName = CleanFileName(Path + '\MARXMENU.EXE')
  56.  
  57. Write ' Creating MARX.BAT ... '
  58.  
  59. ;----- BatExit is a 0k bat file used to exit batch files
  60.  
  61. FileAssign (BatExit,'BATEXIT.BAT')
  62. FileCreate BatExit
  63. FileClose  BatExit
  64.  
  65. ;----- Here we create the MARX.BAT file.
  66.  
  67. ClearLineBuffer
  68.  
  69. AddLine (EchoSt)
  70. AddLine (ProgName + ' %1 ')
  71. AddLine ('%MXCMD%')
  72. AddLine (CleanFileName(Path + '\MARX.BAT') + ' %1')
  73. AddLine ('')
  74. AddLine ('Goto ERROR1')
  75. AddLine ('')
  76. AddLine ('*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*')
  77. AddLine ('')
  78. AddLine ('MarxMenu * CopyRight 1989-92 by Marc Perkel')
  79. AddLine ('')
  80. AddLine ('Once you are confident that MarxMenu is working correctly')
  81. AddLine ('the first line of this file can be changed to ECHO OFF.')
  82. AddLine ('')
  83. AddLine ('MarxMenu controls this batch file by writing to the environment')
  84. AddLine ('variable MXCMD.')
  85. AddLine ('')
  86. AddLine ('MXSTOP.BAT is executed to exit this batch file.')
  87. AddLine ('')
  88. AddLine ('*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*')
  89. AddLine ('')
  90. AddLine ('         MARX.BAT')
  91. AddLine ('         --------   +--MarxMenu Creates--+')
  92. AddLine ('  +----> @ECHO OFF  |                    |')
  93. AddLine ('  |      MARXMENU.EXE %1                 |')
  94. AddLine ('  |      %MXCMD% >--+                    +-> $MX00000.BAT')
  95. AddLine ('  | +--> MARX %1 +  |                        ------------')
  96. AddLine ('  | |            |  +----------------------> CD\WORDSTAR')
  97. AddLine ('  +-|------<-----+                           WS --+')
  98. AddLine ('    |                                             |')
  99. AddLine ('    +-------------------------------------------<-+')
  100. AddLine ('')
  101. AddLine ('Note: MarxMenu sets MXCMD = CALL $MX00000.BAT')
  102. AddLine ('')
  103. AddLine ('By Default, MarxMenu creates the temporary batch file in the same')
  104. AddLine ('directory as MARXMENU.EXE. If a second parameter is specified, and')
  105. AddLine ('the second parameter is a directory, then MarxMenu will create the')
  106. AddLine ('batch file there. If the second paramerer is a file name, then MarxMenu')
  107. AddLine ('will use it for the temporary file.')
  108. AddLine ('')
  109. AddLine ('If you set and environment variable TEMP to the name of a directory,')
  110. AddLine ("MarxMenu will use this directory for it's temporary batch files.")
  111. AddLine ('')
  112. AddLine ('Example SET TEMP=C:\TEMPFILE')
  113. AddLine ('')
  114. AddLine ('The MARX.BAT file must be path accessable or you will get a')
  115. AddLine ('"Bad Command or FileName" error. MARXMENU.EXE must also be path')
  116. AddLine ('accessable. The directory where MarxMenu creates temporary batch')
  117. AddLine ('files does not need to be path accessable.')
  118. AddLine ('')
  119. AddLine ('*-=-=-=-=-=-=-=-=-=-=[ Error Trapping Section ]-=-=-=-=-=-=-=-=-*')
  120. AddLine ('')
  121. AddLine ('If you get here it is probably because you moved the MARX.BAT file')
  122. AddLine ("from the directory you installed it to a new directory and didn't")
  123. AddLine ('change the path to MARXMENU.EXE and MARX.BAT in lines 2 and 4 of')
  124. AddLine ('this batch file.')
  125. AddLine ('')
  126. AddLine (':ERROR1')
  127. AddLine ('CLS')
  128. AddLine ('Echo  * * * * * * Warning * * * * * * *')
  129. AddLine ('Echo.')
  130. AddLine ('Echo  Line 4 of this batch file does not point to the directory')
  131. AddLine ('Echo  where MARX.BAT is located. Change to the directory where')
  132. AddLine ('Echo  the MARXMENU files are located and type MARXMENU INST to')
  133. AddLine ('Echo  re-create the MARX.BAT file for that directory.')
  134. AddLine ('')
  135. AddLine ('Goto ENDBAT')
  136. AddLine ('')
  137. AddLine ('*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*')
  138. AddLine ('')
  139. AddLine ('This exit point is used if MXSTOP.BAT can not be found. It is')
  140. AddLine ('usually caused by moving the MarxMenu files from one directory')
  141. AddLine ('to another and not copying all the BAT files. MarxMenu sets the')
  142. AddLine ('environment variable MXCMD to GOTO E in order to get here.')
  143. AddLine ('')
  144. AddLine ('*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*')
  145. AddLine ('')
  146. AddLine (':E')
  147. AddLine ('CLS')
  148. AddLine ('Echo  * * * * * * Warning * * * * * * *')
  149. AddLine ('Echo.')
  150. AddLine ('Echo  The file MXSTOP.BAT, DROPTO.BAT, and BATEXIT.BAT should be in')
  151. AddLine ('Echo  the same directory as the MARX.BAT file. Run MARXMENU INST in')
  152. AddLine ('Echo  the directory where you want MARX.BAT to reside.')
  153. AddLine (':ENDBAT')
  154.  
  155.  
  156. WriteTextFile 'MARX.BAT' FileLine
  157.  
  158. ClearLineBuffer
  159.  
  160. ;----- Here we create the DROPTO.BAT file.
  161.  
  162. Writeln
  163. Write ' Creating DROPTO.BAT ... '
  164.  
  165. AddLine ('DEL %1')
  166. AddLine ('SET KSV=')
  167. AddLine ('SET MXCMD=')
  168. AddLine ('%2 %3 %4 %5 %6 %7 %8 %9')
  169. AddLine ('BATEXIT')
  170. AddLine ('')
  171. AddLine ('*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*')
  172. AddLine ('')
  173. AddLine ('DropTo is used when you want to eliminate the temporary batch')
  174. AddLine ('file created by MarxMenu. This is useful if you shell to DOS')
  175. AddLine ('and then run MarxMenu from the dos shell. It avoids the')
  176. AddLine ('"Missing Batch File" error.')
  177. AddLine ('')
  178. AddLine ('DropTo is run from within the temporary batch file you want')
  179. AddLine ('to eliminate.')
  180. AddLine ('')
  181. AddLine ('Usage: DROPTO %0 <command line>')
  182. AddLine ('')
  183. AddLine ("Here's how it works:")
  184. AddLine ('')
  185. AddLine ('     $MX00000.BAT <------deletes this file--------+')
  186. AddLine ('     ------------                                 |')
  187. AddLine ('     DROPTO %0 COMMAND.COM ------------> DEL %1 >-+')
  188. AddLine ('                                         SET KSV=')
  189. AddLine ('                                         SET MXCMD=')
  190. AddLine ('              %2 executes command.com--> %2 %3 %4 %5 %6 %7 %8 %9')
  191. AddLine ('')
  192. AddLine ('*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*')
  193.  
  194. WriteTextFile 'DROPTO.BAT' FileLine
  195.  
  196. ClearLineBuffer
  197.  
  198. ;----- Here we create the MXSTOP.BAT file.
  199.  
  200. Writeln
  201. Write ' Creating MXSTOP.BAT ... '
  202.  
  203. AddLine ('SET MXCMD=')
  204. AddLine ('SET KSV=')
  205. AddLine ('REM From here, you control the menu exit process!')
  206.  
  207. WriteTextFile 'MXSTOP.BAT' FileLine
  208.  
  209. ClearLineBuffer
  210.  
  211. ;----- Here we create the GOFILE.BAT file.
  212.  
  213. Writeln
  214. Write ' Creating GOFILE.BAT ... '
  215.  
  216. AddLine (EchoSt)
  217. AddLine ('MARXMENU GOFILE %1')
  218. AddLine ('REM This batch file is used only with the GOFILE menu.')
  219.  
  220. WriteTextFile 'GOFILE.BAT' FileLine
  221.  
  222. ClearLineBuffer
  223.  
  224. ;----- Here we create the \LOGIN\OFF.BAT file.
  225.  
  226. if ExistDir '\LOGIN' and NetworkVersion
  227.    if not ExistFile '\LOGIN\OFF.BAT'
  228.  
  229.       Writeln
  230.       Write ' Creating OFF.BAT ... '
  231.  
  232.       AddLine ('ECHO ON')
  233.       AddLine ('')
  234.       AddLine ('REM This batch file is used to log off the network.')
  235.       AddLine ('REM Add the commands you want to execute when logoff occurs here.')
  236.       AddLine ('')
  237.       AddLine ('LOGOUT')
  238.  
  239.       WriteTextFile '\LOGIN\OFF.BAT' FileLine
  240.  
  241.       ClearLineBuffer
  242.    endif
  243. endif
  244.  
  245. Wait PauseTime
  246. EraseTopWindow
  247.  
  248. CheckEnvSize
  249.  
  250. EraseTopWindow
  251. BoxBorderColor Yellow Mag
  252. BoxInsideColor White Mag
  253. DrawBox 18 10 44 7
  254. BoxBorderColor LGreen Blue
  255. BoxInsideColor Yellow Blue
  256. DrawBox 23 12 34 3
  257. WriteCenter 'MarxMenu Installed!'
  258. Wait PauseTime * 2
  259. EraseTopWindow
  260. EraseTopWindow
  261.  
  262. FinalWarning
  263.  
  264. ExitMenu
  265.  
  266. ;--- Menu Exits Here
  267.  
  268. ;===================== Procedures ========================
  269.  
  270. ;--- Check the environment size
  271.  
  272. Procedure CheckEnvSize
  273. var NeededSpace ShellCommand OldComspec
  274.    if EnvFree < 150
  275.       OldComspec = ReadEnv('COMSPEC')
  276.       ConfigSysPath = ExistOnPath( 'CONFIG.SYS' )
  277.       NeededSpace = (EnvSize + 160) / 16 * 16
  278.       if DosVerNumber < 320
  279.          ShellCommand = Str(NeededSpace / 16)
  280.       else
  281.          ShellCommand = Str(NeededSpace)
  282.       endif
  283.       if ConfigSysPath = ''
  284.          BoxBorderColor LCyan Blue
  285.          BoxInsideColor White Blue
  286.          DrawBox 15 8 51 13
  287.          WriteCenter '* Warning! *'
  288.          Writeln char(7)
  289.          Writeln '  You have a total of ' EnvSize ' bytes of environment'
  290.          Writeln '  space with only ' EnvFree ' bytes free. MarxMenu'
  291.          Writeln '  requires about 150 bytes of free environment'
  292.          Writeln '  space. You should modify you CONFIG.SYS file'
  293.          Writeln '  as follows:'
  294.          Writeln
  295.          WriteCenter 'SHELL=COMMAND.COM /P /E:' ShellCommand
  296.          Writeln
  297.          Writeln
  298.          WriteCenter(' * Press any Key to Continue * ')
  299.          Cursor Off
  300.          LastKey = ReadKey
  301.          EraseTopWindow
  302.       else
  303.          ReadTextFile(ConfigSysPath,ConfigSysLines)
  304.          Loop(NumberOfElements(ConfigSysLines))
  305.            WorkStr = UpperCase(ConfigSysLines[LoopIndex])
  306.            If (NextWord( WorkStr) = 'SHELL')
  307.              Delete( ConfigSysLines,LoopIndex,1)
  308.            EndIf
  309.          EndLoop
  310.          ShellCommand = 'SHELL=' + OldComspec + ' /P /E:' + ShellCommand
  311.          ConfigSysLines[NumberOfElements(ConfigSysLines) + 1] = ShellCommand
  312.          WriteTextFile(ConfigSysPath,ConfigSysLines)
  313.       endIf
  314.    endIf
  315. EndProc
  316.  
  317.  
  318. Procedure AddLine (L)
  319.    FileLinePtr = FileLinePtr + 1
  320.    FileLine[FileLinePtr] = L
  321. EndProc
  322.  
  323.  
  324. Procedure ClearLineBuffer
  325.    Dispose(FileLine)
  326.    FileLinePtr = 0
  327. EndProc
  328.  
  329.  
  330. Procedure InitialDisplay
  331.    if ColorScreen
  332.       TextColor Cyan Blue
  333.       ClearScreen 176
  334.       GotoXY 1 25
  335.       TextColor Yellow Mag
  336.       ClearLine
  337.       WriteCenter 'MarxMenu Version ' MarxVersion ' * Copyright 1989-92 by Marc Perkel'
  338.       BoxBorderColor White Brown
  339.       BoxInsideColor Yellow Brown
  340.       BoxHeaderColor Yellow Mag
  341.       ClockColor Yellow Brown
  342.       TextColor Yellow Brown
  343.    else
  344.       ClearScreen 176
  345.       TextColor Black Grey
  346.       GotoXY 1 25
  347.       ClearLine
  348.       WriteCenter 'MarxMenu Version ' MarxVersion ' * Copyright 1989-92 by Marc Perkel'
  349.       BoxBorderColor Black Grey
  350.       BoxInsideColor Black Grey
  351.       BoxHeaderColor Black Grey
  352.       ClockColor Black Grey
  353.    endif
  354.  
  355.    SingleLineBox
  356.    Explode Off
  357.    DrawBox 1 1 80 3
  358.    GotoXY (54,1)
  359.    Write "MarxMenu Installation"
  360.    ClockPos 3 2
  361.  
  362.    BlankTime = 0
  363.    ScrollMove Off
  364.  
  365.    Explode On
  366.    Shadow Off
  367.    BlockBox
  368.    InverseColor Yellow Red
  369.  
  370.    BoxBorderColor Yellow Mag
  371.    BoxInsideColor Mag Mag
  372.    DrawBox 10 6 61 17
  373.    BoxBorderColor LGreen Blue
  374.    BoxInsideColor Yellow Blue
  375.    Shadow On
  376.  
  377.    DrawBox 35 13 11 3
  378.    WriteCenter 'The'
  379.    Loop 5
  380.       MoveWindow -4 -1
  381.       Wait 3
  382.    EndLoop
  383.  
  384.    DrawBox 35 13 11 3
  385.    WriteCenter 'Marx'
  386.    Loop 5
  387.       MoveWindow 4 -1
  388.       Wait 3
  389.    EndLoop
  390.  
  391.    DrawBox 35 13 11 3
  392.    WriteCenter 'Menu'
  393.    Loop 5
  394.       MoveWindow -4 1
  395.       Wait 3
  396.    EndLoop
  397.  
  398.    DrawBox 35 13 11 3
  399.    WriteCenter 'System'
  400.    Loop 5
  401.       MoveWindow 4 1
  402.       Wait 3
  403.    EndLoop
  404.  
  405.    Wait 20
  406.    DrawBox 25 13 31 3
  407.    WriteCenter 'Installation Menu'
  408.    Wait 250
  409.    RollWindow 4
  410.    EraseTopWindow
  411.    Wait 20
  412.    RollWindow 3
  413.    EraseTopWindow
  414.    Wait 20
  415.    RollWindow 2
  416.    EraseTopWindow
  417.    Wait 20
  418.    RollWindow 1
  419.    EraseTopWindow
  420.    Wait 20
  421.    EraseTopWindow
  422. EndProc
  423.  
  424.  
  425. Procedure FinalWarning
  426.    BoxBorderColor LCyan Blue
  427.    BoxInsideColor White Blue
  428.    DrawBox 14 9 52 11
  429.    WriteCenter '* Warning! *'
  430.    Writeln
  431.    Writeln
  432.    Writeln '  One common mistake that users make is running'
  433.    Writeln '  MARXMENU <menu>. You are supposed to run menus'
  434.    Writeln '  by typing MARX <menu> which uses the MARX.BAT'
  435.    Writeln '  file. Also, besides reading the manual, please'
  436.    Writeln '  read the MARXREAD.ME file.'
  437.    Writeln
  438.    WriteCenter( ' * Press any Key to Continue * ' )
  439.    Cursor Off
  440.    LastKey = ReadKey
  441.    EraseTopWindow
  442. EndProc
  443.